home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / lib.fmt / c / accept.man < prev    next >
Encoding:
Text File  |  1989-03-08  |  3.2 KB  |  133 lines

  1.  
  2.  
  3.  
  4. ACCEPT                C Library Procedures                 ACCEPT
  5.  
  6.  
  7.  
  8. NNAAMMEE
  9.      accept - accept a connection on a socket
  10.  
  11. SSYYNNOOPPSSIISS
  12.      ##iinncclluuddee <<ssyyss//ttyyppeess..hh>>
  13.      ##iinncclluuddee <<ssyyss//ssoocckkeett..hh>>
  14.  
  15.      nnss == aacccceepptt((ss,, aaddddrr,, aaddddrrlleenn))
  16.      iinntt nnss,, ss;;
  17.      ssttrruucctt ssoocckkaaddddrr **aaddddrr;;
  18.      iinntt **aaddddrrlleenn;;
  19.  
  20. DDEESSCCRRIIPPTTIIOONN
  21.      The argument _s is a socket that has been created with
  22.      _s_o_c_k_e_t(2), bound to an address with _b_i_n_d(2), and is listen-
  23.      ing for connections after a _l_i_s_t_e_n(2).  _A_c_c_e_p_t extracts the
  24.      first connection on the queue of pending connections,
  25.      creates a new socket with the same properties of _s and allo-
  26.      cates a new file descriptor, _n_s, for the socket.  If no
  27.      pending connections are present on the queue, and the socket
  28.      is not marked as non-blocking, _a_c_c_e_p_t blocks the caller
  29.      until a connection is present.  If the socket is marked
  30.      non-blocking and no pending connections are present on the
  31.      queue, _a_c_c_e_p_t returns an error as described below.  The
  32.      accepted socket, _n_s, may not be used to accept more connec-
  33.      tions.  The original socket _s remains open.
  34.  
  35.      The argument _a_d_d_r is a result parameter that is filled in
  36.      with the address of the connecting entity, as known to the
  37.      communications layer.  The exact format of the _a_d_d_r parame-
  38.      ter is determined by the domain in which the communication
  39.      is occurring.  The _a_d_d_r_l_e_n is a value-result parameter; it
  40.      should initially contain the amount of space pointed to by
  41.      _a_d_d_r; on return it will contain the actual length (in bytes)
  42.      of the address returned.  This call is used with
  43.      connection-based socket types, currently with SOCK_STREAM.
  44.  
  45.      It is possible to _s_e_l_e_c_t(2) a socket for the purposes of
  46.      doing an _a_c_c_e_p_t by selecting it for read.
  47.  
  48. RREETTUURRNN VVAALLUUEE
  49.      The call returns -1 on error.  If it succeeds, it returns a
  50.      non-negative integer that is a descriptor for the accepted
  51.      socket.
  52.  
  53. EERRRROORRSS
  54.      The _a_c_c_e_p_t will fail if:
  55.  
  56.      [EBADF]             The descriptor is invalid.
  57.  
  58.      [ENOTSOCK]          The descriptor references a file, not a
  59.                          socket.
  60.  
  61.  
  62.  
  63. Sprite v1.0               May 22, 1986                          1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. ACCEPT                C Library Procedures                 ACCEPT
  71.  
  72.  
  73.  
  74.      [EOPNOTSUPP]        The referenced socket is not of type
  75.                          SOCK_STREAM.
  76.  
  77.      [EFAULT]            The _a_d_d_r parameter is not in a writable
  78.                          part of the user address space.
  79.  
  80.      [EWOULDBLOCK]       The socket is marked non-blocking and no
  81.                          connections are present to be accepted.
  82.  
  83. SSEEEE AALLSSOO
  84.      bind(2), connect(2), listen(2), select(2), socket(2)
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129. Sprite v1.0               May 22, 1986                          2
  130.  
  131.  
  132.  
  133.